1. stackoverflow.com

    As gniourf_gniourf has explained in the comments, the reason that your alias wasn't working was because the $1 in your awk command was being expanded by the shell. The value is likely to be empty, so the awk command becomes {print } and pwdx is being passed both parts of the output of jps.. You can avoid having to escape the $ by avoiding using awk entirely; you can use the -q switch rather ...
  2. unix.stackexchange.com

    The forms with the function keyword have the advantage of working even if myfunction is an alias (you can use \myfunction … to make the standard form work in that case). Apart from the alias thing, these syntaxes are exactly equivalent in bash. What follows the function name or the must be a well-formed complex command.
  3. serverfault.com

    Pipe Alias are implemented by local(8) postfix agent. relay=virtual. This means you are using the virtual(8) agent delivery to [email protected] but you need local(8) to fetch that email. Maybe you using virtual as your local_transport or you need to put in your 'virtual_alias_maps' file something like: [email protected] support@localhost
  4. superuser.com

    As long as your alias is in your .bashrc, you should be able to do ...|xargs bash -c somealias ... Easier is to put your alias in a shell script instead. Make ~/bin, add it to your PATH, put the script in, and your original command will work. Example shell script: #!/bin/bash sudo -u ubuntu somecommand "$@"
  5. superuser.com

    So alias comes as a compromise. Verbosity like the function keyword helps me define code parsers or generators later. - kakyo. Commented Apr 17, 2019 at 2:25. @tom-fenech - I'm going to poke around in some of the other shells I tend to use, but out of curiosity, what are some of the shells that are incompatible?
  6. unix.stackexchange.com

    Using an alias is generally not good practice in non-interactive shell scripts ( BashFAQ/080).The way you have the alias defined in your OP, only the first commands reads from the standard input, because ; terminates your standard input from going beyond your first command.. One possible way is to do a command grouping using {..}, so that any re-directions apply to the entire set of commands ...
  7. unix.stackexchange.com

    I.e, if the alias start with a pipe, aliasing doesn't seem to work properly. Is there a way to do this? bash; alias; Share. ... Aliases allow a string to be substituted for a word when it is used as the first word of a simple command. Pipe can't be the first word of a simple command.
  8. The reason the default shell environment lists mostly functions and nearly no aliases is because functions are better for all but the simplest commands (example exception: alias ls='ls --color=auto'). $ set | grep ' ()' | wc -l 78 $ set | grep 'alias' | wc -l 4. 78 Functions. 4 aliases. Says it all.
  9. superuser.com

    You're piping it into a new bash process as input. That process doesn't load your initialization scripts though, so there's no alias defined. Check the section INVOCATION in man bash: Depending on the file in which you defined the alias, you need to make the bash process either a login shell (-l) or interactive (-i) to load that file.. There's an additional restriction: Aliases are ignored ...

    Can’t find what you’re looking for?

    Help us improve DuckDuckGo searches with your feedback

  1. As gniourf_gniourf has explained in the comments, the reason that your alias wasn't working was because the $1 in your awk command was being expanded by the shell. The value is likely to be empty, so the awk command becomes {print } and pwdx is being passed both parts of the output of jps.

    You can avoid having to escape the $ by avoiding using awk entirely; you can use the -q switch rather than piping to awk:

    jpsdir() {
        jps -q | xargs pwdx
    }

    I would personally prefer to use a function but you can use an alias if you like.

    --Tom Fenech

    Was this helpful?
Custom date rangeX